package exportimporterentities;

import java.util.ArrayList;

import api.entitites.IGarage;
import api.entitites.IMaster;
import api.entitites.IOrder;
import api.exportimportentities.IExportImportEntities;
import api.messages.Messager;

public class ExportImportEntities implements IExportImportEntities {

	private ArrayList<String> arrayMessanger = new ArrayList<String>();
	

	private Export exporter = new Export();
	private Import importer = new Import();

	public ArrayList<String> ExportGarages(IGarage garage) {
		arrayMessanger.clear();
		try {
			exporter.exportGarage(garage);
			arrayMessanger.add(Messager.EXPORT);
		} catch (RuntimeException e) {
			arrayMessanger.add(e.getMessage());
		}
		return arrayMessanger;
	}

	public ArrayList<String> ExportMasters(IMaster master) {
		arrayMessanger.clear();
		try {
			exporter.exportMaster(master);
			arrayMessanger.add(Messager.EXPORT);
		} catch (RuntimeException e) {
			arrayMessanger.add(e.getMessage());
		}
		return arrayMessanger;
	}

	public ArrayList<String> ExportOrders(IOrder order) {
		arrayMessanger.clear();
		try {
			exporter.exportOrder(order);
			arrayMessanger.add(Messager.EXPORT);
		} catch (RuntimeException e) {
			arrayMessanger.add(e.getMessage());
		}
		
		return arrayMessanger;

	}

	public ArrayList<IGarage> ImportGarages() {
		
			return importer.getGarages();
		
	}

	public ArrayList<IMaster> ImportMasters() {
		
		return importer.getMasters();
			
		
	}

	public ArrayList<IOrder> ImportOrders() {
		return importer.getOrders();
			
	}

}
